package svc

import (
	"shorturl/api/internal/config"
	"shorturl/api/internal/middleware"
	"shorturl/rpc/transform/transformer"

	"github.com/zeromicro/go-zero/zrpc"
)

type ServiceContext struct {
	Config              config.Config
	Transformer         transformer.Transformer
	UserAgentMiddleware middleware.UserAgentMiddleware
}

func NewServiceContext(c config.Config) *ServiceContext {
	return &ServiceContext{
		Config:              c,
		Transformer:         transformer.NewTransformer(zrpc.MustNewClient(c.Transform)),
		UserAgentMiddleware: *middleware.NewUserAgentMiddleware(),
	}
}
